<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('调班')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-classes-chg">
        <div class="form-group">
            <label class="col-sm-3 control-label">转出班级：</label>
            <div class="col-sm-3">
                <input name="className" th:field="*{teachingClasses.className}" class="form-control" type="text"
                       disabled>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">转入班级：</label>
            <div class="col-sm-3">
                <select id="toClassId" name="toClassId" class="form-control">
                    <option th:each="classes: ${classList}"
                            th:value="${classes.classId}"
                            th:text="${classes.className}">
                    </option>
                </select>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var applyId = [[${teachingStudentApply.applyId}]];
    var studentId = [[${teachingStudentApply.studentId}]];
    var schoolId = [[${teachingStudentApply.schoolId}]];
    var status = "1";
    var classStudentId = [[${teachingClassesStudents.classStudentId}]];
    var perfix = ctx + "teaching/students";

    function submitHandler() {
        chgClass();
    }

    function chgClass() {
        var classId = $("#toClassId").val();
        $.ajax({
            type: "post",
            url: perfix + "/chgClassSave",
            async: false,
            data: {
                "classStudentId1": classStudentId,
                "studentId": studentId,
                "applyId": applyId,
                "classId": classId,
                "schoolId": schoolId,
            }, success: function (r) {
                if (r.code == 0) {
                    refreshTab();
                    $.modal.close();
                    $.modal.alertSuccess("调班成功");
                } else {
                    $.modal.msg(r.msg);
                }
            }
        })
    }
</script>
</body>
</html>